package com.isias.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.isias.model.El.ElQu;
import com.isias.model.dto.RepoAndIdDto;
import com.isias.model.vo.ElQuQueryVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ElQuMapper extends BaseMapper<ElQu> {
    IPage<ElQu> SeletePage(Page<ElQu> pageparam, @Param("vo") ElQuQueryVo elQuQueryVo);//分页查询

    List<ElQu> SeleteAll(@Param("vo")ElQuQueryVo elQuQueryVo);  //查询全部

    IPage<ElQu> SeletePageOrdinary(Page<ElQu> pageparam,@Param("vo")ElQuQueryVo elQuQueryVo);
    Integer AddQuToRepo(String repoId, String quId);  //添加题目到题库

    Integer DeleteQuToRepo(String repoId, String quId); //从题库删除题目

    Integer DeleteQusToRepo(String repoId, List<String> ids);   //从题库批量删除题目

    List<RepoAndIdDto> GetRepoAndId();

    @Select("select count(*) from el_qu_repo where repo_id = #{repoId} and qu_id = #{quId} and is_deleted = 0")
    Integer findIdByRepoIdAndQuId(String repoId, String quId);
}
